@echo off

set ftp_ip=172.17.160.55
set ftp_name=weiyi
set ftp_pwd=123456
set riil_install_path=C:\RuiJie\RIIL
set apm_install_path=%riil_install_path%\RIIL_TRACE
set ftp_riil_trace_version=20180509173308
set agent_pkg=trace-agent
set z7="C:\Program Files\7-Zip\7z.exe"
rd /s /q %apm_install_path%
del RIIL_TRACE.7z
ncftpget -u %ftp_name% -p %ftp_pwd% -R %ftp_ip% . /home/weiyi/riil_trace_publish/%ftp_riil_trace_version%/RIIL_TRACE.7z
if exist RIIL_TRACE.7z (%z7% x RIIL_TRACE.7z -o%apm_install_path% -aoa) else ( echo get ftp file error )
if exist %apm_install_path% (
copy /y %riil_install_path%\RIIL_BMC\bin\startup.bat %riil_install_path%\RIIL_BMC\bin\startup.bat_bak
copy /y %apm_install_path%\startup_shell\RIIL\BMC\startup.bat %riil_install_path%\RIIL_BMC\bin\startup.bat
copy /y %riil_install_path%\RIIL_CCS\bin\startup.bat %riil_install_path%\RIIL_CCS\bin\startup.bat_bak
copy /y %apm_install_path%\startup_shell\RIIL\CCS\startup.bat %riil_install_path%\RIIL_CCS\bin\startup.bat
) else (
    echo build error
)